{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Fasting Diet\n", "## Problem I\n", "You have read an article about the benefits of fasting. This article publishes a series of findings around the fasting diet method. Specifically, the article states that: \n", "\n", "- Decreasing the number of meals to three, two heavier meals and a light meal in between has significant benefits for the health \n", "\n", "- The study reveals that the optimal amount of daily calories for an adult is higher than 1800 \n", "\n", "- and also lower than 2200 calories\n", "\n", "- The study also reveals that the light meal should not represent more than 10% of the number of daily calories\n", "\n", "- And that the last meal should not provide more than 700 calories\n", "\n", "\n", "You think you can design a Linear Programming Problem where the decision variables represent the calories of each meal to find and optimal diet that fulfils all these requirements, while at the same time provide the maximum number of calories. For such a model, define:\n", "\n", "**a.** The objective function\n", "\n", "Maximise the calories intake in the three mails: \n", "\n", "$max z = x_1 + x_2+x_3$ \n", "\n", "where:\n", " - $x_1$: Calories of first meal\n", " \n", " - $x_2$: Calories of second meal (light meal)\n", " \n", " - $x_3$: Calories of third meal\n", " \n", "**b.** The constraints\n", "Now, given the results of the study: \n", "\n", "Optimal daily amount\n", "\n", "$x_1+x_2+x_3 \\geq 1800$\n", "\n", "$x_1+x_2+x_3 \\leq 2200$\n", "\n", "Calories of light meal (less than 10% of total calories):\n", "\n", "$x_2 \\leq 0.1(x_1+x_2+x_3)$\n", "\n", "Calories of third meal (less than 700):\n", "\n", "$x_3 \\leq 700$\n", "\n", "**c.** The dual problem\n", "\n", "We can write the problem as: \n", "\n", "$\\max z = x_1 + x_2+x_3$\n", "\n", "$\\text{s.t.}$\n", "\n", "$x_1+x_2+x_3 \\geq 1800$\n", "\n", "$x_1+x_2+x_3 \\leq 2200$\n", "\n", "$-0.1·x_1 + 0.9·x_2 -0.1·x_3 \\leq 0$\n", "\n", "$0·x_1 + 0·x_2 + 1·x_3 \\leq 700$\n", " \n", "Hence, the dual becomes: \n", "\n", "$\\min z = 1800·u_1 + 2200·u_2 + 0·u_3 + 700·u_4$\n", "\n", "$\\text{s.t}$\n", "\n", "$u_1+u_2-0.1*u_3+0·u_4 \\geq 1$\n", "\n", "$u_1 + u_2 + 0.9·u_3 + 0·u_4 \\geq 1$\n", "\n", "$u_1 + u_2 -0.1·u_3 + u_3 \\geq 1$\n", "\n", "Since the primal is a maximisation problem, $u_1 \\leq 0$ because the first constraint is of type $\\geq$. On the other hand, $u_2, u_3, u_4 \\leq 0$ because the rest of constraints are of type $\\leq$.\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", "source": [], "metadata": { "collapsed": false } } } }, "nbformat": 4, "nbformat_minor": 2 }